package com.julius.design.pattern.prototype;

/**
 * <p>
 *      原型模式测试
 * </p>
 */
public class PrototypeTest {


    public static void main(String[] args) throws CloneNotSupportedException {
        PrototypeCache prototypeCache = new PrototypeCache();


        Shape circle = prototypeCache.getShape("circle");

        System.out.println(circle.getId()+"---"+circle.getType());

        System.out.println(circle);
        System.out.println(prototypeCache.getShape("circle"));
        System.out.println(prototypeCache.getShape("circle"));

        Shape square = prototypeCache.getShape("square");

        System.out.println(square);
        System.out.println(square.getId()+"---"+square.getType());

        
        Shape square1 = prototypeCache.getShape("square");
        System.out.println(square1);
        System.out.println(square1.getId()+"---"+square1.getType());

        Shape square2 = prototypeCache.getShape("square");
        System.out.println(square2);
        System.out.println(square2.getId()+"---"+square2.getType());



    }
}
